package core;

import javax.swing.JFrame;

public class TD_Demultiplexer extends UnitAbstract {

	public TD_Demultiplexer() {
		inputs = new String[]{"0"};
		outputs = new String[] {"1", "2", "3", "4"};
	}
	
	@Override
	public void read(DataPackage dataPack, String tPort) {
			
		int channel = (int)dataPack.data[0];
		
		double[] data = new double[dataPack.data.length - 1];
		
		System.arraycopy(dataPack.data, 1, data, 0, dataPack.data.length - 1);
		
		dataPack.data = data;
		
		
		sendData(dataPack, String.valueOf(channel));
	}

	@Override
	public JFrame getFrame() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public String toString() {
		return "Demultiplexer TDM";
	}
}
